<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>
    <title>心理咨询预约系统</title>
    <script type="text/javascript" src="__USER__/js/jquery-1.8.0.js"></script>
    <!--    <script type="text/javascript" src="__USER__/jq/jquery.md5.js"></script>-->
    <script src="__USER__/js/layui/layui.js"></script>
    <link rel="stylesheet" href="__USER__/js/layui/css/layui.css">
    <link rel="stylesheet" href="__USER__/css/base.css">
    <link rel="stylesheet" href="__USER__/css/page/head.css">
    <link rel="stylesheet" href="__USER__/css/page/foot.css">
    <link rel="stylesheet" href="__USER__/css/page/index.css">
</head>
<body>
<div class="head-box">
    <div class="head-tit layui-row">
        <div class="headTit-inner layui-col-md-offset2 layui-col-md8">
            <div class="fl headTit-left">
                <div class="logo fl" style="margin-left: -40%">
                    <img src="__USER__/img/logo.png">
                </div>
                <div class="tit-txt fl" style="margin-left: -25%">
                    <div class="head-tit-bg"><a href="index.html">预约咨询服务平台</a></div>
                    <div class="head-tit-sm">预约诊疗服务平台</div>
                </div>
            </div>
            <div class="fr headTit-right layui-row" style="width: 500px">
                <ul>
                    <li class="layui-nav-item" style="margin-left:95%;margin-top:2%;width: 700px">
                        <a href="../student/info.html"><span style="font-size: 14px; color: #010101">欢迎,   </span><span
                                style="font-size: 20px; color: #0f6bed">   {$Request.session.studentname}   </span> </a>
                        <a style="text-decoration: none" href="javascript:void(0);" onclick="message()"><i
                                class="layui-icon layui-icon-notice"
                                title="消息"><span style="font-size: 14px; color: #2BC807">（{$count}）</span></i></a>

                        <a href="../student/logout"> <span style="font-size: 14px; color: #010101">    ,   退出</span></a>
                    </li>
                </ul>
                <div class="layui-row">

                </div>
            </div>
        </div>
    </div>

    <div class="head-tab layui-row">
        <div class="headTab-inner layui-col-md-offset2 layui-col-md8">
            <ul class="headTab-ul">
                <li>
                    <a href="order.html">预约咨询</a>
                </li>
                <li>
                    <a href="info.html">个人中心</a>
                </li>
                <li>
                    <a href="myorder.html">我的预约</a>
                </li>
                <li>
                    <a href="know.html">了解教师</a>
                </li>
                <li>
                    <a href="message.html">留言建议</a>
                </li>
            </ul>
        </div>
    </div>
</div>
<hr class="hr20">
<div class="layui-form" style="font-size: 15px">
    <div>
        <div style="font-family: 楷体;font-size: 30px;margin-left: 47%">新增留言</div>
        <hr class="hr15">
        <div class="layui-form-item" style="font-family: Consolas; margin-left: 24%">
            <div class="layui-inline">
                <label class="layui-form-label">留言对象：</label>
                <div class="layui-input-inline">
                    <select id="towho" name="towho" lay-verify="required" autocomplete="off" class="layui-input">
                        <option value="0"></option>
                        <option value="admin">系统管理员</option>
                        <option value="expert">--教师--</option>
                        {volist name="expert" id="vo"}
                        <option value="{$vo.name}">{$vo.name}</option>
                        {/volist}
                        <option value="expert">--教师--</option>
                    </select>
                </div>
            </div>
        </div>

        <div class="layui-form-item" style="font-family: Consolas; margin-left: 24%">
            <div class="layui-inline">
                <label class="layui-form-label" style="margin-top: 25%">留言内容：</label>
                <div class="layui-input-inline">
                    <textarea rows="10" cols="30" id="content" name="content" required lay-verify="required"
                              placeholder="采用匿名留言方式可以畅所欲言！" autocomplete="off"
                              style="width: 640px; height: 200px;margin: 0;"></textarea>
                </div>
            </div>
        </div>

        <hr class="hr20">
        <div class="layui-form-item" style="font-family: Consolas;font-size: 18px; margin-left: 40%">
            <label class="layui-form-label"></label>
            <button class="layui-btn" id="submit" type="button">提交留言</button>
        </div>
        <hr class="hr20">
    </div>
</div>
<div class="layui-row">
    <div class="layui-col-md-offset2 layui-col-md8">
        <div class="cardTit">
            <!-- <span class="cardTit-tit">友情链接</span> -->
        </div>
        <div class="body-card">
            <div id="linkurl" class="link-box">
            </div>
        </div>
    </div>
    <div class="layui-col-md12 foot-about">
        <div class="about-box">
            <div><a href="aboutUs.html">关于我们</a></div>
            <span>|</span>
            <div><a href="yinsi.html">隐私条款</a></div>
            <span>|</span>
            <div><a href="contactUs.html">联系我们</a></div>
            <div class="clear"></div>
        </div>
        <div>Copyright © 2019 - 2025 WEDOCTOR. All Rights Reserved. 苏孙举 版权所有</div>
    </div>
</div>
<script>

    layui.use(['form', 'layer', 'jquery', 'table'], function () {
        var table = layui.table;
        $ = layui.jquery;
        var form = layui.form,
            layer = layui.layer;

        var flag = 0;

        //检查设置默认图片
        $(document).ready(function () {

            //消息检测
            if (flag == 0) {
                $.ajax({
                    type: "get",
                    url: "{:url('Student/checkmessage')}",
                    async: false,
                    success: function (data) {
                        console.log(data);
                        if (data != 0) {
                            layer.msg("您有（" + data + "）条新信息，请注意查看！");
                            flag = 1;
                        }
                    }
                });
            }
        });
    });

    //显示消息
    function message() {
        layer.open({
            type: 2,
            title: '',
            shadeClose: true,
            shade: 0.7,
            area: ['809px', '500px'],
            content: ['notify'],
            end: function () {
                $.ajax({
                    type: "get",
                    url: "{:url('Student/changenotify')}",
                    async: false,
                    success: function (data) {
                        console.log(data);
                        //考虑读完之后数字为0
                    }
                });
            }
        });
    }

    layui.use(['form', 'layer', 'jquery', 'table'], function () {
        var table = layui.table;
        $ = layui.jquery;
        var form = layui.form,
            layer = layui.layer;

        $("#submit").click(function () {
            var content = $('#content').val();
            var towho = $('#towho').val();
            console.log(content);
            console.log(towho);
            if (towho == 0) {
                layer.msg("请选择留言对象！", {icon: 2, time: 1000}, function () {
                    setTimeout('window.location.reload()', 100);
                });
            } else if (content == '') {
                layer.msg("请输入留言内容！", {icon: 2, time: 1000}, function () {
                    setTimeout('window.location.reload()', 100);
                });
            } else if (towho == 'expert') {
                layer.msg("请选择给哪位老师留言！", {icon: 2, time: 1000}, function () {
                    setTimeout('window.location.reload()', 100);
                });
            } else {
                $.ajax({
                    type: "post",
                    url: "../Student/meaasgeinsert",
                    dataType: "json",
                    data: {"content": content, "towho": towho},
                    async: false,//必须是同步提交的
                    success: function (data) {
                        ///console.log(data);
                        if (data.data == 1) {
                            layer.msg("留言成功！", {icon: 1, time: 1000}, function () {
                                setTimeout('window.location.reload()', 100);
                            });
                        } else {
                            layer.msg("留言失败！", {icon: 2, time: 1000}, function () {
                                setTimeout('window.location.reload()', 100);
                            });
                        }
                    },
                });
            }

        });
    });
</script>
</body>
</html>